//
//  DRBluetoothManager.h
//  DoctorRen
//
//  Created by Lemon on 2018/11/22.
//

#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>

typedef enum{
    DeviceStyleNormal = 0,  //默认状态
    DeviceStyleScanning = 1,//正在扫描
    DeviceStyleLinging = 2,   //正在链接
    DeviceStyleLingSucceed = 3, //链接成功
    DeviceStyleMeasuringWeight = 4,//测量体重
    DeviceStyleMeasuringResistance = 5,//测量阻抗
    DeviceStyleMeasuringHeartRate = 6, //测量心率
    DeviceStyleMeasuringSucceed = 7,     //测量完成
    DeviceStyleDisconnect = 8,         //断开连接/称关机
}DeviceStyle;


@protocol DRBluetoothDelegate <NSObject>

////点击连接按钮
//- (void)didClickStart;
////连接成功
//- (void)BLEConnectSucceed;
//收到的数据
- (void)receivedValue:(NSData *)data;
//更新状态
-(void) didUpdateDevice:(DeviceStyle) style;

@end

NS_ASSUME_NONNULL_BEGIN

@interface DRBluetoothManager : NSObject

//代理
@property (nonatomic, weak) id<DRBluetoothDelegate> delegate;

+(instancetype)manager;

//开始连接
- (void)startConnectWithName:(NSString *) name serviceUUID:(NSString *)service characteristicUUID: (NSString *) uuid needWriteData:(BOOL) isNeed;
//断开连接
- (void)endConnect;
//读数据
- (void)readFromPeripheral;
//写数据
- (void)writeToPeripheralWith:(NSString *)name;
//监听数据
- (void)notifyPeripheral;


@end

NS_ASSUME_NONNULL_END
